﻿//        Another Demo from Andy L. & MissedMemo.com
// Borrow whatever code seems useful - just don't try to hold
// me responsible for any ill effects. My demos sometimes use
// licensed images which CANNOT legally be copied and reused.

using System;
using System.Windows.Data;
using System.Windows;


// HACK: We must explicitly show-hide embedded WinForms control
// to force it to match the animation state of its WPF container.
 
namespace MissedMemo.MeatAndCheeseDisc.OrderEntry
{
    public class WinFormsControlVisibilityConverter : IValueConverter
    {
        public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
        {
            double containerHeight = (double)value;

            // Container height varies between zero and full height, so we
            // use an arbitrary non-zero threshold to show/hide our control
            return containerHeight > 200 ? Visibility.Visible : Visibility.Hidden;
        }


        public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
        {
            throw new NotImplementedException();
        }
    }
}
